home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ Sep 89 / Y0071-Re[2] IDType vs ite-Sep89 < prev    next >
Encoding:
Text File  |  1989-09-22  |  1.2 KB  |  36 lines  |  [TEXT/GEOL]

  1. Item    2919378                         21-Sept-89        23:52
  2.  
  3. From:   MUYSVASOVIC1                    ER&D - J-D Muys-Vasovic
  4.  
  5. To:     MACAPP.TECH$                    MACAPP Tech
  6.  
  7. Sub:    Re: Re: IDType vs item number
  8.  
  9. In that case what I would do personally is to assign consecutives IDs for all
  10. the radios, say 'rad1', 'rad2', ..., 'radX', and then use the ids as an index
  11. into my array, declared as (if you have 8 radio buttons):
  12.  
  13. VAR myArray: ARRAY['rad1' .. 'rad8'] of TWhatever;
  14.  
  15. The key here is to remember that Pascal allows you to specify the lower bound
  16. of an array (without wasting space of course). This is maybe a little too
  17. forgotten in those "C" days...
  18.  
  19. There is a small problem though: 'rad1' is of type OSType, ie PACKED
  20. ARRAY[1..4] of CHAR, ie NOT longint. Therefore, the declaration above is
  21. illegal. After trying several solutions, the only working way to circumvent the
  22. type checking of the compiler is to write something like that:
  23.  
  24. const
  25.    low = ((ord('r') * 256 + ord('a')) * 256 + ord('d')) * 256 + 1;
  26.   up = ((ord('r') * 256 + ord('a')) * 256 + ord('d')) * 256 + 8;
  27. var
  28.      a: ARRAY[low..up] of longint;
  29.  
  30. to access the array, you would write a[longint('rad1')] for example.
  31.  
  32. hope that helps!!
  33.  
  34. Jean-Denis
  35.  
  36.